// pages/index/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    showTaocanList: false,
    showMenuBtn: false,
    activeVideoIndex: 0,
    videoLists: [{
      id: '1',
      video: 'http:8080/video/1.mp4',
      title: '套餐1',
      image: '/mocks/images/taocan-1.png'
    }, {
      id: '2',
      video: 'http://localhost:8000video/2.mp4',
      title: '套餐2',
      image: '/mocks/images/taocan-2.png'
    }, {
      id: '3',
      video: 'http://localhost:8000/video/3.mp4',
      title: '套餐3',
      image: '/mocks/images/taocan-3.png'
    }, {
      id: '4',
      video: 'http://localhost:8000/video/1.mp4',
      title: '套餐4',
      image: '/mocks/images/taocan-1.png'
    }, {
      id: '5',
      video: 'http://localhost:8000/video/.mp4',
      title: '套餐5',
      image: '/mocks/images/taocan-2.png'
    }, {
      id: '6',
      video: 'http://localhost:8000/video/3.mp4',
      title: '套餐6',
      image: '/mocks/images/taocan-3.png'
    }]
  },

  toggleMenuHandler() {
    this.setData({
      showTaocanList: !this.data.showTaocanList
    })
  },

  toggleVideoControlsHandler(event) {
    const isShow = event.detail.show
    this.setData({
      showMenuBtn: isShow
    })
  },

  changeVideoHandler(e) {
    let index = e.currentTarget.dataset['index'];
    this.setData({
      activeVideoIndex: index
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})